package com.king.designpatterns.行为模式.访问者模式;

/**
 * 结构对象 - 计算机，由CPU和硬盘组成
 * @author king
 * @date 2021-06-11 11:30
 */
public class Computer {
    private Hardware cpu;
    private Hardware harddisk;

    public Computer() {
        this.cpu = new CPU("Intel Core i7-620");
        this.harddisk = new Harddisk("Seagate 500G 7200转");
    }

    public void accept(ComputerVisitor computerVisitor){
        cpu.accept(computerVisitor);
        harddisk.accept(computerVisitor);
    }
}
